<template>
  <div class="exception">
    <img :src="getImageUrl('404')" alt=""/>
    <el-button class="btn-home" @click="goHome">回到上一个页面</el-button>
  </div>
</template>

<script setup lang="ts">
import {useImageUrl} from '@/assets/js/utils'
import {useRouter} from 'vue-router'

const {getImageUrl} = useImageUrl()
const router = useRouter()
const goHome=()=>{
  //go方法：按指定方向访问历史。如果是正数则是路由记录向前跳转，如果是负数则是向后回退
  router.go(-1)
}
</script>

<style lang="less" scoped>
.exception {
  position: relative;
  img {
    width: 100%;
    height: 100vh;
  }
  .btn-home {
    position: absolute;
    left: 50%;
    bottom: 100px;
    margin-left: -34px;
  }
}
</style>